<div class='ZZHT-search-container clearfix'>
	<div class='ZZHT-logo fl'>
		<a href="../view/index.html" title="华猫商城">
			<img src="../images/index/logo.png" title="华猫商城" alt="华猫商城" height="60">
		</a>
	</div>
	<div class="ZZHT-search-box">
		<div class='ZZHT-search'>
			<input type="text" id='search-ipt' class='search-ipt' placeholder='' value='' />
			<div id='search-btn' class="search-btn" onclick='javascript:Hsearch(this.value)'>搜索</div>
		</div>
	</div>
	<div class="ZZHT-cart-box">
		<a href="../carts/carts.html" target="_blank">
			<span class="word j-word"><i class="icon-cart"></i>我的购物车(<span class="goodsNum">0</span>)</span>
		</a>
		<div class="ZZHT-cart-boxs">
			<div id="list-carts" class="clearfix">
				<div style="padding:32px 0px 77px 112px;"><img src="../plugin/layer/default/loading-0.gif" style="vertical-align: middle;">正在加载数据...</div>
			</div>
			<div id="list-carts2" class="clearfix">
				<!--<p class="carts">购物车中空空如也，赶紧去选购吧～</p>-->
			</div>
			<div id="list-carts3" class="clearfix"></div>
			<div class="ZZHT-clear"></div>
		</div>
	</div>
</div>
<div class="ZZHT-clear"></div>

<script>
	$('.ZZHT-cart-box').hover(function() {
		$(this).children('.ZZHT-cart-boxs').show();
		changeCart();
	}, function() {
		$(this).children('.ZZHT-cart-boxs').hide();
	});
	
	var changeCart = function() {
		$('#list-carts3').html('');
		$.get(SURL + "sktCarts/selectCartsByuserId", {userId: localStorage.userId}, function(data) {
			var json = data;
			if(json.messageCode == 200) {
				var json = json.entity;
				$('.goodsNum').html(json.length);
				if(json.length > 0) {
					var htmla = '<div class="clearfix" id="list-comm" style="text-align:center;">&nbsp;&nbsp;共<span>' +json.length + '</span>件商品 </div>';
					$('#list-carts2').html(htmla);
					$('#list-carts3').html('<a href="../carts/carts.html" class="btn btn-3">去购物车结算</a>');
					var html = '';	
					for(var i=0;i<json.length;i++){
						if(i<3){//显示前三件商品
							html+='<div class="goods" id="j-goods"'+json[i].cartId+'">'
							   	+'<div class="imgs"><a href=""><img class="goodsImgc" src="'+imgUrl+json[i].goodsImg+'" title=""></a></div>'
							   	+'<div class="number"><p><a  href="">'+json[i].goodsName+'</a></p><p>数量：'+json[i].cartNum+'</p></div>'
							   	+'<div class="price"><p>'+json[i].shopPrice+'</p></div>'
							+'</div>';
						}
					}
					$('#list-carts').html(html);
				} else {
					$('#list-carts').html('<p class="carts">购物车中空空如也，赶紧去选购吧～</p>');
				}
			}
		});
	};
	changeCart();
</script>